/**
 * Copyright (c) 2016-2021 by the respective copyright holders.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zigbee.dongle.xbee.internal.protocol;


/**
 * Class to implement the XBee command <b>Set Energy Scan</b>.
 * <p>
 * AT Command <b>ED</b></p>Start an Energy Detect scan. This command accepts an argument to
 * specify the time in milliseconds to scan IEEE 802.15.4 channels 11 through 26. The device
 * loops through all 16 channels until the time elapses and returns the maximal energy on each
 * channel. In Transparent mode, a comma must follow each value with the list ending with a
 * carriage return. The values returned reflect the detected energy level in units of -dBm.
 * Convert an ED response of 49, 3A, and so on, to decimal to become -73 dBm, -58 dBm, and so on.
 * <p>
 * This class provides methods for processing XBee API commands.
 * <p>
 * Note that this code is autogenerated. Manual changes may be overwritten.
 *
 * @author Chris Jackson - Initial contribution of Java code generator
 */
public class XBeeSetEnergyScanCommand extends XBeeFrame implements XBeeCommand {
    /**
     */
    private Integer frameId;

    /**
     */
    private Integer scanTime;

    /**
     *
     * @param frameId the frameId to set as {@link Integer}
     */
    public void setFrameId(Integer frameId) {
        this.frameId = frameId;
    }

    /**
     *
     * @param scanTime the scanTime to set as {@link Integer}
     */
    public void setScanTime(Integer scanTime) {
        this.scanTime = scanTime;
    }

    @Override
    public int[] serialize() {
        // Serialize the command fields
        serializeCommand(0x08);
        serializeInt8(frameId);
        serializeAtCommand("ED");
        serializeInt8(scanTime);

        return getPayload();
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder(384);
        // First present the command parameters...
        // Then the responses later if they are available
        builder.append("XBeeSetEnergyScanCommand [frameId=");
        builder.append(frameId);
        builder.append(", scanTime=");
        builder.append(scanTime);
        builder.append(']');
        return builder.toString();
    }
}
